<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // spread 
    // let arr = [1,2,3,4];

    // 展开数组
    // ...arr  =>  1,2,3,4

    // 测试
    // function fn(){
    //   console.log(arguments);
    // }

    // fn(...arr);// fn(1,2,3,4);

    //将数组 arr 的值放到 arr2 中
    // let arr = [5,6,7];//
    // let arr2 = [1,2,3,4, ...arr];

    // 展开对象
    let obj = {
      a: 100,
      b: 200,
      c: 'test'
    };
    //合并对象
    let obj2 = {
      c: 300,
      d: 400,
      ...obj
    };

    console.log(obj2);





  </script>
</body>
</html>